<template>
  <div>
    <h2>添加专业</h2>
    专业名称<input type="text" v-model="name">
    <button @click="sub">添加</button>
  </div>
</template>

<script>
export default {
  data(){
    return{
      name:''
    }
  },
  methods:{
    sub:function(){
      this.axios({
        url:'http://127.0.0.1:8000/zhuanye/',
        method:'post',
        data:{'name':this.name}
      }).then(res=>{
        alert('成功')
      },error=>{
        alert(error.response.data);
      }
      );
    }
  }
}
</script>

<style>

</style>
